function [s_hat,signal] = mmse_nulling(h,r,rho,nt)

g=h;
gamma=r;

signal=[];

s_hat=zeros(nt,1);
index_glossary=zeros(nt,1);

for m=1:nt
	p=(sqrt(rho/nt)*g'*g + diag(diag(ones(nt))));
	d=diag(p);
	for k=1:length(index_glossary)
		if(index_glossary(k)~=0)
			d(k)=100000000000;
		end
	end
	[value,index]=min(d);

	w=g(:,index);

	index_glossary(index)=1;
	z=w'*gamma;
	sk=(bin2qpsk(qpsk2bin(z)));
	hk=h(:,index);
	gamma=gamma-sqrt(rho/nt)*sk*hk;
	s_hat(index)=sk;

	for k=1:length(index_glossary)
		if(index_glossary(k)~=0)
			g(:,k)=zeros(nt,1);
		end
	end
end

signal=[];
for m=1:length(r)
	signal=horzcat(signal,qpsk2bin(s_hat(m)));
end

